package com.wei.czz.common.vo.common.limitConfig;

import com.wei.czz.common.jsr303.group.Save;
import com.wei.czz.common.jsr303.group.Update;
import com.wei.czz.common.tool.BaseEntity;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * Created by IntelliJ IDEA.
 *
 * @author wei
 * date: 2023-02-17 16:11:49
 * className: LimitConfigVo 限流配置参数类
 * version: 1.0
 * description:
 */
@Getter
@Setter
public class LimitConfigVo extends BaseEntity {

    /**
     * 主键
     */
    @NotNull(message = "主键不能为空", groups = { Update.class })
    private Long id;

    /**
     * 接口路径
     */
    @NotBlank(message = "接口路径不能为空", groups = { Save.class, Update.class })
    private String requestKey;

    /**
     * 限流类型[0-请求 1-异常]
     */
    @NotNull(message = "限流类型不能为空", groups = { Save.class, Update.class })
    private Integer type;

    /**
     * 时间数值
     */
    @NotNull(message = "时间数值不能为空", groups = { Save.class, Update.class })
    private Integer timeNum;

    /**
     * 时间单位[0-秒 1-分 2-时 3-日 4-月 5-年]
     */
    @NotNull(message = "时间单位不能为空", groups = { Save.class, Update.class })
    private Integer timeType;

    /**
     * 滑动窗口数量
     */
    @NotNull(message = "滑动窗口数量不能为空", groups = { Save.class, Update.class })
    @Min(value = 10, message = "滑动窗口数量不能小于10", groups = { Save.class, Update.class })
    private Integer windowNum;

    /**
     * 最大次数
     */
    @NotNull(message = "最大次数不能为空", groups = { Save.class, Update.class })
    private Integer maxNum;

    /**
     * 限流时长（秒）
     */
    @NotNull(message = "限流时长不能为空", groups = { Save.class, Update.class })
    private Integer limitTime;

    /**
     * 限流回复消息
     */
    @NotBlank(message = "限流回复消息不能为空", groups = { Save.class, Update.class })
    private String message;

    /**
     * 版本号
     */
    @NotNull(message = "版本号不能为空", groups = { Update.class })
    private Integer version;

    /**
     * 状态[0-可用 1-不可用]
     */
    @NotNull(message = "状态不能为空", groups = { Save.class, Update.class })
    private Integer status;

}
